local key = KEYS[1]
local noteId = ARGV[1]

-- 判断 Key 是否存在
local exited = redis.call("EXISTS", key)
if exited == 0 then
    return -1
end

local isLiked = redis.call("BF.EXISTS", key, noteId)
if isLiked == 1 then
    return 1
end

redis.call("BF.ADD", key, noteId)
return 0